# initialization of libraries for general use
# be sure that the following packages are installed
#   dplyr
#   ggplot2
#   lme4
#   Matrix and matrixStats
#   readxl
#   tidyr and tidyverse
#   fitdistrplus
#   sjPlot
#   ggpubr
#   lmerTest
library(matrixStats)
library(lme4)
library(tidyverse)
library(readxl)
library(ggplot2)
library(fitdistrplus)
library(sjPlot)  #for plotting lmer and glmer mods
library(ggpubr)
library(lmerTest)
# load data
CRP <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/cell_recurring_probability.xlsx")
View(CRP)
# linear mixed model statistics CRP
# load data
CRP <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/cell_recurring_probability.xlsx")
# filter out some data that shouldn't be included
CRP_values <- CRP %>%
filter(session1_mobility_pass == 1 | session2_mobility_pass == 1 ) %>%
filter(drug == 'altered contexts' | drug == 'saline') %>%
filter(genotype == 'a5-i-KO')
# make sure you compare with saline baseline
CRP_values$drug <- factor(CRP_values$drug, levels = c("saline", "altered contexts"))
# test using LMEM & ANOVA
CRP_values.model= lmer (Cell_Recurring_Probability ~ drug + (1|animal_ID) + (1|expt_date), data=CRP_values, REML=TRUE)
anova(
CRP_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
CRP_values.model= lmer (Cell_Recurring_Probability ~ drug + (1|animal_ID) + (1|expt_date), data=CRP_values, REML=TRUE)
plot(residuals(CRP_values.model),las=1, ylim=c(-1,1))
hist(residuals(CRP_values.model),las=1)
qqnorm(residuals(CRP_values.model),las=1)
qqline(residuals(CRP_values.model), col = "red", lwd=2)
summary(CRP_values.model)
sjPlot::plot_model(CRP_values.model, title = "CRP_values ~ drug + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(CRP_values.model, title = "CRP_values ~ drug + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
clc
Mobility
# load data
Mobility <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/Mobility.xlsx")
View(Mobility)
# load data
Mobility <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/Mobility.xlsx")
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15)
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15) %>%
filter(drug != 'altered contexts') %>%
filter(genotype == 'a5-i-KO')
View(Mobility_values)
# load data
Mobility <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/Mobility.xlsx")
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15) %>%
filter(drug != 'altered contexts') %>%
filter(genotype == 'a5-i-KO')
# set saline as baseline
Mobility_values$drug <- factor(Mobility_values$drug, levels = c("saline", "etomidate 2mg/kg", "etomidate 4mg/kg", "etomidate 6mg/kg", "etomidate 7mg/kg", "etomidate 8mg/kg"))
# test using LMEM & ANOVA
Mobility_values.model= lmer (Session1_Mobility ~ drug + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
anova(
Mobility_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
Mobility_values.model= lmer (Session1_Mobility ~ drug + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
plot(residuals(Mobility_values.model),las=1, ylim=c(-1,1))
hist(residuals(Mobility_values.model),las=1)
qqnorm(residuals(Mobility_values.model),las=1)
qqline(residuals(Mobility_values.model), col = "red", lwd=2)
summary(Mobility_values.model)
sjPlot::plot_model(Mobility_values.model, title = "Mobility_values ~ drug + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(Mobility_values.model, title = "Mobility_values ~ drug + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
# linear mixed model statistics Mobility
# load data
Mobility <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/Mobility.xlsx")
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15) %>%
filter(drug != 'altered contexts')
# compare with p-WT (baseline)
Mobility_values$genotype <- factor(Mobility_values$genotype, levels = c("p-WT", "a5-i-KO", 'a5-pyr-KO'))
# make sure you compare with saline baseline
Mobility_values$drug <- factor(Mobility_values$drug, levels = c("saline", "etomidate 2mg/kg", "etomidate 4mg/kg", "etomidate 6mg/kg", "etomidate 7mg/kg", "etomidate 8mg/kg"))
# test using LMEM & ANOVA
Mobility_values.model= lmer (Session1_Mobility ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
anova(
Mobility_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
Mobility_values.model= lmer (Session1_Mobility ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
plot(residuals(Mobility_values.model),las=1, ylim=c(-1,1))
hist(residuals(Mobility_values.model),las=1)
qqnorm(residuals(Mobility_values.model),las=1)
qqline(residuals(Mobility_values.model), col = "red", lwd=2)
summary(Mobility_values.model)
sjPlot::plot_model(Mobility_values.model, title = "Mobility_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(Mobility_values.model, title = "Mobility_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
View(Mobility_values)
# load data
Mobility <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/Mobility.xlsx")
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15) %>%
filter(drug == 'saline' | drug == 'etomidate 7mg/kg')
# compare with p-WT (baseline)
Mobility_values$genotype <- factor(Mobility_values$genotype, levels = c("p-WT", "a5-i-KO", 'a5-pyr-KO'))
# just include saline baseline
Mobility_values$drug <- factor(Mobility_values$drug, levels = c("saline", "etomidate 7mg/kg"))
# test using LMEM & ANOVA
Mobility_values.model= lmer (Session1_Mobility ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
anova(
Mobility_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
Mobility_values.model= lmer (Session1_Mobility ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
plot(residuals(Mobility_values.model),las=1, ylim=c(-1,1))
hist(residuals(Mobility_values.model),las=1)
qqnorm(residuals(Mobility_values.model),las=1)
qqline(residuals(Mobility_values.model), col = "red", lwd=2)
summary(Mobility_values.model)
sjPlot::plot_model(Mobility_values.model, title = "Mobility_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(Mobility_values.model, title = "Mobility_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15) %>%
filter(drug != 'altered contexts') %>%
filter(genotype == 'a5-pyr-KO')
# load data
Mobility <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/Mobility.xlsx")
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15) %>%
filter(drug != 'altered contexts') %>%
filter(genotype == 'a5-pyr-KO')
# set saline as baseline
Mobility_values$drug <- factor(Mobility_values$drug, levels = c("saline", "etomidate 2mg/kg", "etomidate 4mg/kg", "etomidate 6mg/kg", "etomidate 7mg/kg", "etomidate 8mg/kg"))
# test using LMEM & ANOVA
Mobility_values.model= lmer (Session1_Mobility ~ drug + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
anova(
Mobility_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
Mobility_values.model= lmer (Session1_Mobility ~ drug + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
plot(residuals(Mobility_values.model),las=1, ylim=c(-1,1))
hist(residuals(Mobility_values.model),las=1)
qqnorm(residuals(Mobility_values.model),las=1)
qqline(residuals(Mobility_values.model), col = "red", lwd=2)
summary(Mobility_values.model)
sjPlot::plot_model(Mobility_values.model, title = "Mobility_values ~ drug + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(Mobility_values.model, title = "Mobility_values ~ drug + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
# load data
mean_ER <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/mean_ER.xlsx")
View(mean_ER)
# linear mixed model statistics mean_ER
# load data
mean_ER <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/mean_ER.xlsx")
# filter out some data that shouldn't be included
mean_ER_values <- mean_ER %>%
filter(session1_mobility_pass == 1 & session2_mobility_pass == 1) %>%
filter(drug != 'altered contexts') %>%
filter(genotype == 'a5-i-KO')
# make sure you compare with saline baseline
mean_ER_values$drug <- factor(mean_ER_values$drug, levels = c("saline", "etomidate 2mg/kg", "etomidate 4mg/kg", "etomidate 6mg/kg", "etomidate 7mg/kg", "etomidate 8mg/kg"))
# test using LMEM & ANOVA
mean_ER_values.model= lmer (Session1_Mean_Event_Rate ~ drug + (1|animal_ID) + (1|expt_date), data=mean_ER_values, REML=TRUE)
anova(
mean_ER_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
mean_ER_values.model= lmer (Session1_Mean_Event_Rate ~ drug + (1|animal_ID) + (1|expt_date), data=mean_ER_values, REML=TRUE)
plot(residuals(mean_ER_values.model),las=1, ylim=c(-1,1))
hist(residuals(mean_ER_values.model),las=1)
qqnorm(residuals(mean_ER_values.model),las=1)
qqline(residuals(mean_ER_values.model), col = "red", lwd=2)
summary(mean_ER_values.model)
sjPlot::plot_model(mean_ER_values.model, title = "mean_ER_values ~ drug + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(mean_ER_values.model, title = "mean_ER_values ~ drug + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
View(mean_ER_values.model)
# linear mixed model statistics mean_ER
# load data
mean_ER <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/mean_ER.xlsx")
# filter out some data that shouldn't be included
mean_ER_values <- mean_ER %>%
filter(session1_mobility_pass == 1 & session2_mobility_pass == 1) %>%
filter(drug != 'altered contexts') %>%
filter(genotype == 'a5-pyr-KO')
# make sure you compare with saline baseline
mean_ER_values$drug <- factor(mean_ER_values$drug, levels = c("saline", "etomidate 2mg/kg", "etomidate 4mg/kg", "etomidate 6mg/kg", "etomidate 7mg/kg", "etomidate 8mg/kg"))
# test using LMEM & ANOVA
mean_ER_values.model= lmer (Session1_Mean_Event_Rate ~ drug + (1|animal_ID) + (1|expt_date), data=mean_ER_values, REML=TRUE)
anova(
mean_ER_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
mean_ER_values.model= lmer (Session1_Mean_Event_Rate ~ drug + (1|animal_ID) + (1|expt_date), data=mean_ER_values, REML=TRUE)
plot(residuals(mean_ER_values.model),las=1, ylim=c(-1,1))
hist(residuals(mean_ER_values.model),las=1)
qqnorm(residuals(mean_ER_values.model),las=1)
qqline(residuals(mean_ER_values.model), col = "red", lwd=2)
summary(mean_ER_values.model)
sjPlot::plot_model(mean_ER_values.model, title = "mean_ER_values ~ drug + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(mean_ER_values.model, title = "mean_ER_values ~ drug + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
# linear mixed model statistics mean_ER
# load data
mean_ER <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/mean_ER.xlsx")
# filter out some data that shouldn't be included
mean_ER_values <- mean_ER %>%
filter(session1_mobility_pass == 1 & session2_mobility_pass == 1) %>%
filter(drug == 'saline' | drug == 'etomidate 7mg/kg')
# compare with p-WT (baseline)
mean_ER_values$genotype <- factor(mean_ER_values$genotype, levels = c("p-WT", "a5-i-KO", 'a5-pyr-KO'))
# make sure you compare with saline baseline
mean_ER_values$drug <- factor(mean_ER_values$drug, levels = c("saline", "etomidate 7mg/kg"))
# test using LMEM & ANOVA
mean_ER_values.model= lmer (Session1_Mean_Event_Rate ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=mean_ER_values, REML=TRUE)
anova(
mean_ER_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
mean_ER_values.model= lmer (Session1_Mean_Event_Rate ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=mean_ER_values, REML=TRUE)
plot(residuals(mean_ER_values.model),las=1, ylim=c(-1,1))
hist(residuals(mean_ER_values.model),las=1)
qqnorm(residuals(mean_ER_values.model),las=1)
qqline(residuals(mean_ER_values.model), col = "red", lwd=2)
summary(mean_ER_values.model)
sjPlot::plot_model(mean_ER_values.model, title = "mean_ER_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(mean_ER_values.model, title = "mean_ER_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
# linear mixed model statistics mean_ER
# load data
mean_ER <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/mean_ER.xlsx")
# filter out some data that shouldn't be included
mean_ER_values <- mean_ER %>%
filter(session1_mobility_pass == 1 & session2_mobility_pass == 1) %>%
filter(drug == 'saline')
# compare with p-WT (baseline)
mean_ER_values$genotype <- factor(mean_ER_values$genotype, levels = c("p-WT", "a5-i-KO", 'a5-pyr-KO'))
# test using LMEM & ANOVA
mean_ER_values.model= lmer (Session1_Mean_Event_Rate ~ genotype + (1|animal_ID) + (1|expt_date), data=mean_ER_values, REML=TRUE)
anova(
mean_ER_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
mean_ER_values.model= lmer (Session1_Mean_Event_Rate ~ genotype + (1|animal_ID) + (1|expt_date), data=mean_ER_values, REML=TRUE)
plot(residuals(mean_ER_values.model),las=1, ylim=c(-1,1))
hist(residuals(mean_ER_values.model),las=1)
qqnorm(residuals(mean_ER_values.model),las=1)
qqline(residuals(mean_ER_values.model), col = "red", lwd=2)
summary(mean_ER_values.model)
sjPlot::plot_model(mean_ER_values.model, title = "mean_ER_values ~ genotype + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(mean_ER_values.model, title = "mean_ER_values ~ genotype + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
# initialization of libraries for general use
# be sure that the following packages are installed
#   dplyr
#   ggplot2
#   lme4
#   Matrix and matrixStats
#   readxl
#   tidyr and tidyverse
#   fitdistrplus
#   sjPlot
#   ggpubr
#   lmerTest
library(matrixStats)
library(lme4)
library(tidyverse)
library(readxl)
library(ggplot2)
library(fitdistrplus)
library(sjPlot)  #for plotting lmer and glmer mods
library(ggpubr)
library(lmerTest)
# linear mixed model statistics Mobility
# load data
Mobility <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/Mobility.xlsx")
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15) %>%
filter(drug != 'altered contexts')
# compare with p-WT (baseline)
Mobility_values$genotype <- factor(Mobility_values$genotype, levels = c("p-WT", "a5-i-KO", 'a5-pyr-KO'))
# make sure you compare with saline baseline
Mobility_values$drug <- factor(Mobility_values$drug, levels = c("saline", "etomidate 2mg/kg", "etomidate 4mg/kg", "etomidate 6mg/kg", "etomidate 7mg/kg", "etomidate 8mg/kg"))
# test using LMEM & ANOVA
Mobility_values.model= lmer (Session1_Mobility ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
anova(
Mobility_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
Mobility_values.model= lmer (Session1_Mobility ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
plot(residuals(Mobility_values.model),las=1, ylim=c(-1,1))
hist(residuals(Mobility_values.model),las=1)
qqnorm(residuals(Mobility_values.model),las=1)
qqline(residuals(Mobility_values.model), col = "red", lwd=2)
summary(Mobility_values.model)
sjPlot::plot_model(Mobility_values.model, title = "Mobility_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(Mobility_values.model, title = "Mobility_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
# linear mixed model statistics Mobility
# load data
Mobility <- read_excel("D:/Meta_AnaOutput_Graphs/Zhu 2022 GAD paper (combined p-WTs)/Mobility.xlsx")
# filter out some data that shouldn't be included
Mobility_values <- Mobility %>%
filter(Session1_Mobility >= 0.15 & Session2_Mobility >= 0.15) %>%
filter(drug != 'altered contexts')
# compare with p-WT (baseline)
Mobility_values$genotype <- factor(Mobility_values$genotype, levels = c("p-WT", "a5-i-KO", 'a5-pyr-KO'))
# make sure you compare with saline baseline
Mobility_values$drug <- factor(Mobility_values$drug, levels = c("saline", "etomidate 2mg/kg", "etomidate 4mg/kg", "etomidate 6mg/kg", "etomidate 7mg/kg", "etomidate 8mg/kg"))
# test using LMEM & ANOVA
Mobility_values.model= lmer (Session1_Mobility ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
anova(
Mobility_values.model,
type = c("III", "II", "I", "3", "2", "1"),
ddf = "Kenward-Roger")
# perform some plotting
par(mfrow=c(1,3))
Mobility_values.model= lmer (Session1_Mobility ~ drug * genotype + (1|animal_ID) + (1|expt_date), data=Mobility_values, REML=TRUE)
plot(residuals(Mobility_values.model),las=1, ylim=c(-1,1))
hist(residuals(Mobility_values.model),las=1)
qqnorm(residuals(Mobility_values.model),las=1)
qqline(residuals(Mobility_values.model), col = "red", lwd=2)
summary(Mobility_values.model)
sjPlot::plot_model(Mobility_values.model, title = "Mobility_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)")
sjPlot:: tab_model(Mobility_values.model, title = "Mobility_values ~ drug * genotype + (1|animal_ID) + (1|expt_date)",
auto.label = TRUE, show.stat = TRUE, show.df = TRUE, show.se = TRUE)
